package com.eeepay.eeepay_v2.adapter;

import android.content.Context;
import android.graphics.Color;

import com.eeepay.eeepay_v2.R;
import com.eeepay.eeepay_v2.model.AgentInfo;
import com.eeepay.v2_library.adapter.ABBaseAdapter;
import com.eeepay.v2_library.adapter.ABViewHolder;

import cn.eeepay.api.grpc.nano.AgentSerProto;

/**
 * Created by Administrator on 2016/3/11 0011.
 */
public class AgentListAdapter extends ABBaseAdapter<AgentSerProto.AgentBaseInfoApi>{

    public AgentListAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_agent_list;
    }

    @Override
    public void convert(ABViewHolder holder, AgentSerProto.AgentBaseInfoApi model) {
        holder.setText(R.id.tv_title, model.agentName);
        holder.setRightText(R.id.hv_name, model.linkName);
        holder.setRightText(R.id.hv_phone, model.mobilephone);
        //状态  0-关闭进件 , 1-正常 , 2-冻结
        if("0".equals(model.status)){
            holder.setRightText(R.id.hv_state, "关闭进件").setRightTextColor(R.color.red);
        }else if("1".equals(model.status)){
            holder.setRightText(R.id.hv_state, "正常").setRightTextColor(R.color.green);
        }else if("2".equals(model.status)){
            holder.setRightText(R.id.hv_state, "冻结").setRightTextColor(R.color.red);
        }else{

        }

    }
}
